import configparser
import os

#找到配置文件config.ini路径
conf_path = os.path.split(os.path.realpath(__file__))[0]
config_path = os.path.join(conf_path,"config.ini")

#实例化ConfigParaser类,读出配置文件中的内容
conf = configparser.ConfigParser()
conf.read(config_path,encoding='utf-8')

class ReadConfig():
    #获取url地址
    def get_url(self,name):
        value = conf.get('URL',name)
        return value

    #获取邮件相关配置
    def get_mail(self,name):
        value = conf.get('EMAIL',name)
        return value

    #获取下游用户下单相关配置
    def get_place_order(self,name):
        value = conf.get('PLACE_ORDER',name)
        return value

    #获取数据库相关配置
    def get_db(self,name):
        value = conf.get("DATABASE",name)
        return value

    #获取用例、yaml文件、报告等路径
    def get_path(self,name):
        value = conf.get("PATH",name)
        return value

    def get_dingding(self,name):
        value = conf.get("DINGDING",name)
        return value

if __name__ == "__main__":
    print(ReadConfig().get_dingding("appkey"))

